package web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.ui.ModelMap;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import dao.NewsDAO;

import beans.News;

public class NewsController extends MultiActionController{
	
	private NewsDAO newsDAO;

	
	public void setNewsDAO(NewsDAO newsDAO) {
		this.newsDAO = newsDAO;
	}

	public NewsDAO getNewsDAO() {
		return newsDAO;
	}
	
	public ModelAndView news(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
			ModelMap modelMap = new ModelMap();
			modelMap.addAttribute("newsList", newsDAO.DisplayNews());
			return new ModelAndView("news", modelMap);
			}
	
}

